/* 这个文件来放置主界面中的样式 */

.client-container {
    height: 100vh; /* 使用视口高度确保占满屏幕 */
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px; /* 避免边缘紧贴屏幕 */
    box-sizing: border-box;
}

.main {
    /* 改为相对尺寸，支持响应式调整 */
    max-width: 1000px;
    min-width: 600px;
    width: 90vw;
    max-height: 740px;
    min-height: 500px;
    height: 80vh;
    background-color: rgb(238, 238, 238);
    border-radius: 5px;
    display: flex;
    z-index: 2;
}

.main .left {
    width: 28%; /* 保持原280/1000的比例 */
    height: 100%;
    background-color: rgb(46, 50, 56);
    border-top-left-radius: 5px;
    border-bottom-left-radius: 5px;
    display: flex;
    flex-direction: column; /* 垂直布局让内部元素自适应高度 */
}

.main .right {
    width: 72%; /* 保持原720/1000的比例 */
    height: 100%;
    padding: 0 20px;
    box-sizing: border-box; /* 避免padding影响宽度计算 */
    display: flex;
    flex-direction: column; /* 垂直布局让消息区自适应 */
}

.cover {
    width: 100%;
    height: 100%;
    background-image: url(../img/picture.jpeg);
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    filter: blur(20px);
}

.main .left .user {
    height: 80px;
    font-size: 20px;
    line-height: 80px;
    color: white;
    padding: 0 20px;
    flex-shrink: 0; /* 固定高度不压缩 */
}

.main .left .search {
    height: 40px;
    padding: 0 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0; /* 固定高度不压缩 */
}

.main .left .search input {
    height: 34px;
    width: 200px;
    line-height: 34px;
    font-size: 14px;
    color: white;
    background-color: rgb(38, 41, 46);
    border: none;
    outline: none;
    padding-left: 10px;
    border-radius: 5px;
    box-sizing: border-box;
}

.main .left .search button {
    height: 34px;
    width: 34px;
    border: none;
    outline: none;
    background-color: rgb(38, 41, 46);
    border-radius: 5px;
    background-image: url(../img/搜索.png);
    background-repeat: no-repeat;
    background-size: 20px 20px;
    background-position: center center;
    margin-left: 5px; /* 增加间距避免紧贴输入框 */
}

.main .left .search button:active {
    background-color: grey;
}

.main .left .tab {
    height: 50px;
    display: flex;
    align-items: center;
    flex-shrink: 0; /* 固定高度不压缩 */
}

.main .left .tab .tab-session {
    height: 100%;
    width: 50%;
    background-image: url(../img/对话.png);
    background-repeat: no-repeat;
    background-size: 30px 30px;
    background-position: center center;
}

.main .left .tab .tab-friend {
    height: 100%;
    width: 50%;
    background-image: url(../img/用户2.png);
    background-repeat: no-repeat;
    background-size: 30px 30px;
    background-position: center center;
}

.main .left .list {
    flex: 1; /* 自适应剩余高度 */
    overflow: auto;
}

.main .left .list li {
    height: 60px;
    padding: 10px 20px;
    color: white;
    border-top: 1px solid black;
    box-sizing: border-box;
}

.main .left .list .selected {
    background-color: rgb(46, 54, 65);
}

/* 会话列表样式 */
.main .left .list li h3,
.main .left .list li p {
    height: 20px;
    font-size: 14px;
    line-height: 20px;
    margin: 0; /* 清除默认margin避免布局错乱 */
}

/* 好友列表样式 */
.main .left .list li h4 {
    height: 40px;
    line-height: 40px;
    font-size: 20px;
    margin: 0; /* 清除默认margin */
}

/* 隐藏元素类 */
.hide {
    display: none;
}

/* 隐藏滚动条 */
::-webkit-scrollbar {
    display: none;
}

.main .right .title {
    height: 50px;
    line-height: 50px;
    font-size: 20px;
    text-align: center;
    border-bottom: 1px solid #ccc;
    flex-shrink: 0; /* 固定高度不压缩 */
    margin: 0; /* 清除默认margin */
}

.main .right .message-show {
    flex: 1; /* 自适应剩余高度 */
    border-top: 1px solid #ccc;
    border-bottom: 1px solid #ccc;
    overflow: auto;
}

.main .right .message-show .message {
    margin-top: 10px;
    display: flex;
}

/* 左侧消息对齐 */
.main .right .message-show .message-left {
    justify-content: flex-start;
}

/* 右侧消息对齐 */
.main .right .message-show .message-right {
    justify-content: flex-end;
}

.main .right .message-show .message .box {
    width: auto;
    max-width: 80%; /* 限制消息最大宽度，避免过宽 */
}

.main .right .message-show .message .box h4 {
    font-weight: normal;
    height: 20px;
    line-height: 20px;
    font-size: 16px;
    margin: 0 0 5px 0; /* 调整margin优化间距 */
}

.main .right .message-show .message .box p {
    padding: 10px 20px;
    border-radius: 10px;
    margin: 0; /* 清除默认margin */
    word-wrap: break-word; /* 长文本自动换行 */
}

/* 消息背景色 */
.main .right .message-show .message-left .box p {
    background-color: #fff;
}

.main .right .message-show .message-right .box p {
    background-color: rgb(123, 181, 107);
}

.main .right .message-input {
    min-height: 100px; /* 最小高度 */
    max-height: 300px; /* 最大高度限制 */
    height: auto; /* 允许内容撑开 */
    width: 100%;
    border: none;
    outline: none;
    margin-top: 2px;
    background-color: rgb(238, 238, 238);
    padding: 10px;
    resize: vertical; /* 允许垂直拉伸 */
    box-sizing: border-box;
    font-family: inherit; /* 继承字体样式 */
}

.main .right .ctrl {
    height: 35px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    flex-shrink: 0; /* 固定高度不压缩 */
    margin-top: 5px;
}

.main .right .ctrl button {
    height: 35px;
    width: 100px;
    background-color: #fff;
    border: 1px solid #ccc;
    border-radius: 5px;
    cursor: pointer; /* 鼠标悬停显示手型 */
}

.main .right .ctrl button:active {
    background-color: grey;
    color: white;
}